home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / src / X11 / Fresco / build / Unix / config / util / syminst.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1995-07-12  |  1.3 KB  |  91 lines

  1. #!/bin/sh
  2.  
  3. #
  4. # syminst - install with a symbolic link back to the build tree
  5. #
  6.  
  7. # set DOITPROG to echo to test this script
  8.  
  9. doit="${DOITPROG-}"
  10.  
  11.  
  12. # put in absolute paths if you don't have them in your path; or use env. vars.
  13.  
  14. lnprog="${LNPROG-ln -s}"
  15. rmprog="${RMPROG-rm}"
  16.  
  17. instcmd="$lnprog"
  18. rmcmd="$rmprog -f"
  19. srcdir=`pwd`/
  20. src=""
  21. dst=""
  22.  
  23. while [ x"$1" != x ]; do
  24.     case $1 in
  25.     -c) shift
  26.         continue;;
  27.  
  28.     -m) shift
  29.         shift
  30.         continue;;
  31.  
  32.     -o) shift
  33.         shift
  34.         continue;;
  35.  
  36.     -g) shift
  37.         shift
  38.         continue;;
  39.  
  40.     -s) shift
  41.         continue;;
  42.  
  43.     -DIR) srcdir=`echo $2 | sed 's;/\./;/;g'`/
  44.           shift
  45.               shift
  46.               continue;;
  47.  
  48.     *)  if [ x"$src" = x ]
  49.         then
  50.         src=$1
  51.         else
  52.         dst=$1
  53.         fi
  54.         shift
  55.         continue;;
  56.     esac
  57. done
  58.  
  59. if [ x"$src" = x ]
  60. then
  61.     echo "syminst:  no input file specified"
  62.     exit 1
  63. fi
  64.  
  65. if [ x"$dst" = x ]
  66. then
  67.     echo "syminst:  no destination specified"
  68.     exit 1
  69. fi
  70.  
  71.  
  72. # if destination is a directory, append the input filename; if your system
  73. # does not like double slashes in filenames, you may need to add some logic
  74.  
  75. if [ -d $dst ]
  76. then
  77.     dst="$dst"/`basename $src`
  78. fi
  79.  
  80. case $src in
  81.     /*) srcdir=""
  82.     instcmd=cp;;
  83. esac
  84.  
  85. # get rid of the old one and mode the new one in
  86.  
  87. $doit $rmcmd $dst
  88. $doit $instcmd $srcdir$src $dst
  89.  
  90. exit 0
  91.